3.808 \(\int (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx\)

Optimal. Leaf size=84 \[ \frac{(f+g x)^{n+1} \left (a g^2+c f (e f-2 d g)\right )}{g^3 (n+1)}-\frac{2 c (e f-d g) (f+g x)^{n+2}}{g^3 (n+2)}+\frac{c e (f+g x)^{n+3}}{g^3 (n+3)} \]

[Out]

((a*g^2 + c*f*(e*f - 2*d*g))*(f + g*x)^(1 + n))/(g^3*(1 + n)) - (2*c*(e*f - d*g)
*(f + g*x)^(2 + n))/(g^3*(2 + n)) + (c*e*(f + g*x)^(3 + n))/(g^3*(3 + n))

_______________________________________________________________________________________

Rubi [A]  time = 0.121457, antiderivative size = 84, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 1, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.048 \[ \frac{(f+g x)^{n+1} \left (a g^2+c f (e f-2 d g)\right )}{g^3 (n+1)}-\frac{2 c (e f-d g) (f+g x)^{n+2}}{g^3 (n+2)}+\frac{c e (f+g x)^{n+3}}{g^3 (n+3)} \]

Antiderivative was successfully verified.

[In]  Int[(f + g*x)^n*(a + 2*c*d*x + c*e*x^2),x]

[Out]

((a*g^2 + c*f*(e*f - 2*d*g))*(f + g*x)^(1 + n))/(g^3*(1 + n)) - (2*c*(e*f - d*g)
*(f + g*x)^(2 + n))/(g^3*(2 + n)) + (c*e*(f + g*x)^(3 + n))/(g^3*(3 + n))

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 25.7388, size = 78, normalized size = 0.93 \[ \frac{c e \left (f + g x\right )^{n + 3}}{g^{3} \left (n + 3\right )} + \frac{2 c \left (f + g x\right )^{n + 2} \left (d g - e f\right )}{g^{3} \left (n + 2\right )} + \frac{\left (f + g x\right )^{n + 1} \left (a g^{2} - 2 c d f g + c e f^{2}\right )}{g^{3} \left (n + 1\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate((g*x+f)**n*(c*e*x**2+2*c*d*x+a),x)

[Out]

c*e*(f + g*x)**(n + 3)/(g**3*(n + 3)) + 2*c*(f + g*x)**(n + 2)*(d*g - e*f)/(g**3
*(n + 2)) + (f + g*x)**(n + 1)*(a*g**2 - 2*c*d*f*g + c*e*f**2)/(g**3*(n + 1))

_______________________________________________________________________________________

Mathematica [A]  time = 0.115003, size = 92, normalized size = 1.1 \[ \frac{(f+g x)^{n+1} \left (a g^2 \left (n^2+5 n+6\right )+2 c d g (n+3) (g (n+1) x-f)+c e \left (2 f^2-2 f g (n+1) x+g^2 \left (n^2+3 n+2\right ) x^2\right )\right )}{g^3 (n+1) (n+2) (n+3)} \]

Antiderivative was successfully verified.

[In]  Integrate[(f + g*x)^n*(a + 2*c*d*x + c*e*x^2),x]

[Out]

((f + g*x)^(1 + n)*(a*g^2*(6 + 5*n + n^2) + 2*c*d*g*(3 + n)*(-f + g*(1 + n)*x) +
 c*e*(2*f^2 - 2*f*g*(1 + n)*x + g^2*(2 + 3*n + n^2)*x^2)))/(g^3*(1 + n)*(2 + n)*
(3 + n))

_______________________________________________________________________________________

Maple [A]  time = 0.007, size = 147, normalized size = 1.8 \[{\frac{ \left ( gx+f \right ) ^{1+n} \left ( ce{g}^{2}{n}^{2}{x}^{2}+2\,cd{g}^{2}{n}^{2}x+3\,ce{g}^{2}n{x}^{2}+8\,cd{g}^{2}nx-2\,cefgnx+2\,ce{x}^{2}{g}^{2}+a{g}^{2}{n}^{2}-2\,cdfgn+6\,cd{g}^{2}x-2\,cefgx+5\,a{g}^{2}n-6\,cdfg+2\,ce{f}^{2}+6\,a{g}^{2} \right ) }{{g}^{3} \left ({n}^{3}+6\,{n}^{2}+11\,n+6 \right ) }} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  int((g*x+f)^n*(c*e*x^2+2*c*d*x+a),x)

[Out]

(g*x+f)^(1+n)*(c*e*g^2*n^2*x^2+2*c*d*g^2*n^2*x+3*c*e*g^2*n*x^2+8*c*d*g^2*n*x-2*c
*e*f*g*n*x+2*c*e*g^2*x^2+a*g^2*n^2-2*c*d*f*g*n+6*c*d*g^2*x-2*c*e*f*g*x+5*a*g^2*n
-6*c*d*f*g+2*c*e*f^2+6*a*g^2)/g^3/(n^3+6*n^2+11*n+6)

_______________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \[ \text{Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((c*e*x^2 + 2*c*d*x + a)*(g*x + f)^n,x, algorithm="maxima")

[Out]

Exception raised: ValueError

_______________________________________________________________________________________

Fricas [A]  time = 0.294048, size = 294, normalized size = 3.5 \[ \frac{{\left (a f g^{2} n^{2} + 2 \, c e f^{3} - 6 \, c d f^{2} g + 6 \, a f g^{2} +{\left (c e g^{3} n^{2} + 3 \, c e g^{3} n + 2 \, c e g^{3}\right )} x^{3} +{\left (6 \, c d g^{3} +{\left (c e f g^{2} + 2 \, c d g^{3}\right )} n^{2} +{\left (c e f g^{2} + 8 \, c d g^{3}\right )} n\right )} x^{2} -{\left (2 \, c d f^{2} g - 5 \, a f g^{2}\right )} n +{\left (6 \, a g^{3} +{\left (2 \, c d f g^{2} + a g^{3}\right )} n^{2} -{\left (2 \, c e f^{2} g - 6 \, c d f g^{2} - 5 \, a g^{3}\right )} n\right )} x\right )}{\left (g x + f\right )}^{n}}{g^{3} n^{3} + 6 \, g^{3} n^{2} + 11 \, g^{3} n + 6 \, g^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((c*e*x^2 + 2*c*d*x + a)*(g*x + f)^n,x, algorithm="fricas")

[Out]

(a*f*g^2*n^2 + 2*c*e*f^3 - 6*c*d*f^2*g + 6*a*f*g^2 + (c*e*g^3*n^2 + 3*c*e*g^3*n
+ 2*c*e*g^3)*x^3 + (6*c*d*g^3 + (c*e*f*g^2 + 2*c*d*g^3)*n^2 + (c*e*f*g^2 + 8*c*d
*g^3)*n)*x^2 - (2*c*d*f^2*g - 5*a*f*g^2)*n + (6*a*g^3 + (2*c*d*f*g^2 + a*g^3)*n^
2 - (2*c*e*f^2*g - 6*c*d*f*g^2 - 5*a*g^3)*n)*x)*(g*x + f)^n/(g^3*n^3 + 6*g^3*n^2
 + 11*g^3*n + 6*g^3)

_______________________________________________________________________________________

Sympy [A]  time = 6.11464, size = 1530, normalized size = 18.21 \[ \text{result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((g*x+f)**n*(c*e*x**2+2*c*d*x+a),x)

[Out]

Piecewise((f**n*(a*x + c*d*x**2 + c*e*x**3/3), Eq(g, 0)), (-a*f*g**2/(2*f**3*g**
3 + 4*f**2*g**4*x + 2*f*g**5*x**2) + 2*c*d*g**3*x**2/(2*f**3*g**3 + 4*f**2*g**4*
x + 2*f*g**5*x**2) + 2*c*e*f**3*log(f/g + x)/(2*f**3*g**3 + 4*f**2*g**4*x + 2*f*
g**5*x**2) + c*e*f**3/(2*f**3*g**3 + 4*f**2*g**4*x + 2*f*g**5*x**2) + 4*c*e*f**2
*g*x*log(f/g + x)/(2*f**3*g**3 + 4*f**2*g**4*x + 2*f*g**5*x**2) + 2*c*e*f*g**2*x
**2*log(f/g + x)/(2*f**3*g**3 + 4*f**2*g**4*x + 2*f*g**5*x**2) - 2*c*e*f*g**2*x*
*2/(2*f**3*g**3 + 4*f**2*g**4*x + 2*f*g**5*x**2), Eq(n, -3)), (a*g**3*x/(f**2*g*
*3 + f*g**4*x) + 2*c*d*f**2*g*log(f/g + x)/(f**2*g**3 + f*g**4*x) + 2*c*d*f*g**2
*x*log(f/g + x)/(f**2*g**3 + f*g**4*x) - 2*c*d*f*g**2*x/(f**2*g**3 + f*g**4*x) -
 2*c*e*f**3*log(f/g + x)/(f**2*g**3 + f*g**4*x) - 2*c*e*f**2*g*x*log(f/g + x)/(f
**2*g**3 + f*g**4*x) + 2*c*e*f**2*g*x/(f**2*g**3 + f*g**4*x) + c*e*f*g**2*x**2/(
f**2*g**3 + f*g**4*x), Eq(n, -2)), (a*log(f/g + x)/g - 2*c*d*f*log(f/g + x)/g**2
 + 2*c*d*x/g + c*e*f**2*log(f/g + x)/g**3 - c*e*f*x/g**2 + c*e*x**2/(2*g), Eq(n,
 -1)), (a*f*g**2*n**2*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3
) + 5*a*f*g**2*n*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 6
*a*f*g**2*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + a*g**3*n
**2*x*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 5*a*g**3*n*x
*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 6*a*g**3*x*(f + g
*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) - 2*c*d*f**2*g*n*(f + g*x)
**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) - 6*c*d*f**2*g*(f + g*x)**n/(
g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 2*c*d*f*g**2*n**2*x*(f + g*x)**n
/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 6*c*d*f*g**2*n*x*(f + g*x)**n/
(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 2*c*d*g**3*n**2*x**2*(f + g*x)*
*n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 8*c*d*g**3*n*x**2*(f + g*x)*
*n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 6*c*d*g**3*x**2*(f + g*x)**n
/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 2*c*e*f**3*(f + g*x)**n/(g**3*
n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) - 2*c*e*f**2*g*n*x*(f + g*x)**n/(g**3*n
**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + c*e*f*g**2*n**2*x**2*(f + g*x)**n/(g**
3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + c*e*f*g**2*n*x**2*(f + g*x)**n/(g**
3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + c*e*g**3*n**2*x**3*(f + g*x)**n/(g*
*3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 3*c*e*g**3*n*x**3*(f + g*x)**n/(g*
*3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 2*c*e*g**3*x**3*(f + g*x)**n/(g**3
*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3), True))

_______________________________________________________________________________________

GIAC/XCAS [A]  time = 0.267371, size = 558, normalized size = 6.64 \[ \frac{c g^{3} n^{2} x^{3} e^{\left (n{\rm ln}\left (g x + f\right ) + 1\right )} + 2 \, c d g^{3} n^{2} x^{2} e^{\left (n{\rm ln}\left (g x + f\right )\right )} + c f g^{2} n^{2} x^{2} e^{\left (n{\rm ln}\left (g x + f\right ) + 1\right )} + 3 \, c g^{3} n x^{3} e^{\left (n{\rm ln}\left (g x + f\right ) + 1\right )} + 2 \, c d f g^{2} n^{2} x e^{\left (n{\rm ln}\left (g x + f\right )\right )} + 8 \, c d g^{3} n x^{2} e^{\left (n{\rm ln}\left (g x + f\right )\right )} + c f g^{2} n x^{2} e^{\left (n{\rm ln}\left (g x + f\right ) + 1\right )} + 2 \, c g^{3} x^{3} e^{\left (n{\rm ln}\left (g x + f\right ) + 1\right )} + 6 \, c d f g^{2} n x e^{\left (n{\rm ln}\left (g x + f\right )\right )} + a g^{3} n^{2} x e^{\left (n{\rm ln}\left (g x + f\right )\right )} + 6 \, c d g^{3} x^{2} e^{\left (n{\rm ln}\left (g x + f\right )\right )} - 2 \, c f^{2} g n x e^{\left (n{\rm ln}\left (g x + f\right ) + 1\right )} - 2 \, c d f^{2} g n e^{\left (n{\rm ln}\left (g x + f\right )\right )} + a f g^{2} n^{2} e^{\left (n{\rm ln}\left (g x + f\right )\right )} + 5 \, a g^{3} n x e^{\left (n{\rm ln}\left (g x + f\right )\right )} - 6 \, c d f^{2} g e^{\left (n{\rm ln}\left (g x + f\right )\right )} + 5 \, a f g^{2} n e^{\left (n{\rm ln}\left (g x + f\right )\right )} + 6 \, a g^{3} x e^{\left (n{\rm ln}\left (g x + f\right )\right )} + 2 \, c f^{3} e^{\left (n{\rm ln}\left (g x + f\right ) + 1\right )} + 6 \, a f g^{2} e^{\left (n{\rm ln}\left (g x + f\right )\right )}}{g^{3} n^{3} + 6 \, g^{3} n^{2} + 11 \, g^{3} n + 6 \, g^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((c*e*x^2 + 2*c*d*x + a)*(g*x + f)^n,x, algorithm="giac")

[Out]

(c*g^3*n^2*x^3*e^(n*ln(g*x + f) + 1) + 2*c*d*g^3*n^2*x^2*e^(n*ln(g*x + f)) + c*f
*g^2*n^2*x^2*e^(n*ln(g*x + f) + 1) + 3*c*g^3*n*x^3*e^(n*ln(g*x + f) + 1) + 2*c*d
*f*g^2*n^2*x*e^(n*ln(g*x + f)) + 8*c*d*g^3*n*x^2*e^(n*ln(g*x + f)) + c*f*g^2*n*x
^2*e^(n*ln(g*x + f) + 1) + 2*c*g^3*x^3*e^(n*ln(g*x + f) + 1) + 6*c*d*f*g^2*n*x*e
^(n*ln(g*x + f)) + a*g^3*n^2*x*e^(n*ln(g*x + f)) + 6*c*d*g^3*x^2*e^(n*ln(g*x + f
)) - 2*c*f^2*g*n*x*e^(n*ln(g*x + f) + 1) - 2*c*d*f^2*g*n*e^(n*ln(g*x + f)) + a*f
*g^2*n^2*e^(n*ln(g*x + f)) + 5*a*g^3*n*x*e^(n*ln(g*x + f)) - 6*c*d*f^2*g*e^(n*ln
(g*x + f)) + 5*a*f*g^2*n*e^(n*ln(g*x + f)) + 6*a*g^3*x*e^(n*ln(g*x + f)) + 2*c*f
^3*e^(n*ln(g*x + f) + 1) + 6*a*f*g^2*e^(n*ln(g*x + f)))/(g^3*n^3 + 6*g^3*n^2 + 1
1*g^3*n + 6*g^3)